5 function getKey( &$article, &$user ) {
7 $hash = $user->getPageRenderingHash();
8 $pageid = intval( $article->getID() );
9 $key = "$wgDBname:pcache:idhash:$pageid-$hash";
13 function get( &$article, &$user ) {
15 $fname = "ParserCache::get";
16 wfProfileIn( $fname );
18 $hash = $user->getPageRenderingHash();
19 $pageid = intval( $article->getID() );
20 $key = $this->getKey( $article, $user );
21 $value = $wgMemc->get( $key );
23 # Delete if article has changed since the cache was made
24 if ( $value->getTouched() != $article->getTouched() ) {
25 $wgMemc->delete( $key );
32 wfProfileOut( $fname );
36 function save( $parserOutput, &$article, &$user ){
38 $key = $this->getKey( $article, $user );
39 $parserOutput->setTouched( $article->getTouched() );
40 if( $parserOutput->containsOldMagic() ){
41 $expire = 3600; # 1 hour
43 $expire = 7*86400; # 7 days
46 $wgMemc->set( $key, $parserOutput, $expire );